import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:jspang/pages/index_page.dart';
import 'package:jspang/provide/cart.dart';
import 'package:jspang/provide/category_goods_list.dart';
import 'package:jspang/provide/child_category.dart';
import 'package:jspang/provide/counter.dart';
import 'package:jspang/provide/currentIndex.dart';
import 'package:jspang/provide/details_info.dart';
import 'package:jspang/routers/application.dart';
import 'package:jspang/routers/router.dart';
import 'package:provider/provider.dart';

void main() {
  runApp(MultiProvider(providers: [
    ChangeNotifierProvider(create: (context) => Counter(context)),
    ChangeNotifierProvider(create: (context) => ChildCategory(context)),
    ChangeNotifierProvider(create: (context) => CategoryGoodsListProvider()),
    ChangeNotifierProvider(create: (context) => DetailsInfoProvide()),
    ChangeNotifierProvider(create: (context) => CartProvider()),
    ChangeNotifierProvider(create: (context) => CurrentIndexProvider()),
    
  ], child: MyApp()));
}

class MyApp extends StatelessWidget {
  const MyApp({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {

    final router = Router();
    Routers.configureRouter(router);
    Application.router = router;
    return MaterialApp(
      // theme: ThemeData.dark() ,//暗黑模式
      title: "张远涛",
      debugShowCheckedModeBanner: false,
      onGenerateRoute: Application.router.generator,
      theme: ThemeData(primaryColor: Colors.pink),
      home: IndexPage(),
    );
  }
}
